/*
* Copyright (c) 2007 acmesystems.it - john@acmesystems.it
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
*
* Feedback, Bugs...  info@acmesystems.it 
*
*/ 

#include <stdio.h>

#include "libssd1303.h"

int main(int argc, char **argv) {	
	printf("\n\n");
	printf("SSD1303 example application v1.0\n");
	printf("--------------------------------\n\n");
	printf("Made by acmesystems.it (info@acmesystems.it)\n");
	printf("\n");
	
	ssd1303_open();
	
	printf("Starting demo\n");	
	printf("Calling ssd1303_cls\n");
	ssd1303_cls();
	printf("Calling ssd1303_text1\n"); 
	ssd1303_text1(0, 0, "%d hello world", 12);
	sleep(3);

	printf("Calling ssd1303_cls\n");
	ssd1303_cls();
	sleep(3);

	printf("Calling ssd1303_text1\n"); 
	ssd1303_text1(10, 1, "%d hello world", 12);
	ssd1303_text1(20, 2, "Moin Christian");
	sleep(3);	
	
	printf("Calling ssd1303_cls\n");
	ssd1303_cls();
	sleep(3);	

	printf("Calling ssd1303_text1\n"); 
	ssd1303_text1(0, 4, "Gleich geht es los");
	sleep(3);

	printf("Calling ssd_test\n");
	ssd1303_cls();
	ssd1303_test();
	sleep(1);

	printf("Calling ssd1303_cls\n");
	ssd1303_cls();
	sleep(3);		
	
	printf("Calling ssd1303_text1\n"); 
	ssd1303_text1(0, 4, "Es gibt aber noch mehr");
	sleep(3);
	
	printf("Calling ssd1303_cls\n");
	ssd1303_cls();
	sleep(3);	
	
	unsigned char text[1024][64] = {
		{"Back in the good old"},
		{"days-- the \"Golden "},
		{"Era\" of computers--"},
		{"it was easy to separate"},
		{"the men from the boys"},
		{"(sometimes called "},
		{"\"Real Men\" and "},
		{"\"Quiche Eaters\")"},
		{"this period, the Real "},
		{"Men were the ones who"},
		{"understood computer"},
		{"programming, and the"},
		{"Quiche Eaters were the"},
		{"ones who didn't. A real"},
		{"computer programmer said"},
		{"things like \"DO 10 I="},
		{"1,10}\" and \"ABEND\""},
		{"(they actually talked in "},
		{"capital letters, you "},
		{"understand), and the rest"},
		{"of the world said things "},
		{"like \"computers are too"},
		{"complicated for me\" and"},
		{"\"I can't relate to "},
		{"computers-- they're so "},
		{"impersonal\"."},
		{"***************"},
		{""},
	};
	
	printf("Calling ssd1303_scroll_setup\n");
	ssd1303_scroll_setup(&text[0][0], 28);

	printf("Satrting to scroll\n");
	unsigned int foo = 0;
	for(foo = 0; foo < 256; foo++){
		ssd1303_scroll_loop();
		poll(0, 0, 250);
	};
	
	ssd1303_close();
		
	return 0;
}




